﻿using Newtonsoft.Json;
using SqlSugar;
using Zhp.Entity.SysEnum;
using Zhp.SqlSugar.Entity;

namespace Zhp.Entity.Sys
{
    /// <summary>
    /// 菜单表
    /// </summary>
    [SugarTable("Sys_Menu")]
    public class SysMenu : BaseEntity<long>
    {
        /// <summary>
        /// 父级ID
        /// </summary>
        [JsonConverter(typeof(ValueToStringConverter))]
        [SugarColumn(IsNullable = true, ColumnDescription = "父级ID")]
        public long? ParentId { get; set; }

        /// <summary>
        /// 父级ID全路径
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "父级ID全路径")]
        public string Path { get; set; }

        /// <summary>
        /// 层级
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "层级")]
        public int Level { get; set; }

        /// <summary>
        /// 菜单名称
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "菜单名称")]
        public string Name { get; set; }

        /// <summary>
        /// 菜单图标
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "菜单图标")]
        public string Icon { get; set; }

        /// <summary>
        /// 是否有子节点
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "是否有子节点")]
        public bool HasChildren { get; set; }

        /// <summary>
        /// 菜单类型
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "菜单类型")]
        public MenuTypeEnum MenuType { get; set; }

        /// <summary>
        /// 接口地址
        /// </summary>
        [SugarColumn(Length = 500, IsNullable = true, ColumnDescription = "接口地址")]
        public string ApiUrl { get; set; }

        /// <summary>
        /// 权限标识
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "权限标识")]
        public string Permission { get; set; }

        /// <summary>
        /// 前端路由名称
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "前端路由名称")]
        public string RouterName { get; set; }

        /// <summary>
        /// 前端路由地址
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "前端路由地址")]
        public string RouterUrl { get; set; }

        /// <summary>
        /// 前端路由参数
        /// </summary>
        [SugarColumn(Length = 255, IsNullable = true, ColumnDescription = "前端路由参数")]
        public string RouterParams { get; set; }

        /// <summary>
        /// 前端页面组件路径
        /// </summary>
        [SugarColumn(Length = 255, IsNullable = true, ColumnDescription = "前端页面组件路径")]
        public string WebFilePath { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "排序")]
        public decimal? Order { get; set; }

        /// <summary>
        /// 菜单是否隐藏
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "菜单是否隐藏")]
        public bool Hidden { get; set; }

        /// <summary>
        /// 递归类型
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<SysMenu> Children { get; set; }
    }
}
